﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{$token.config.title}</title>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <link rel="apple-touch-icon" type="image/x-icon" href="__IMG__\favicon.ico">
    <link rel="shortcut icon" type="image/x-icon" href="__IMG__{$token.config.image}">
    <link rel="stylesheet" href="__STATIC__/plugin/bootstrap-3.3.7-dist/css/bootstrap.css">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_503496_sgntl8o48mqb0529.css">
    <link rel="stylesheet" href="__CSS__/common/common.css">
    <link rel="stylesheet" href="__CSS__/admin/admin.css">
    <link rel="stylesheet" href="__JS__/layui/css/layui.css">
    <link rel="stylesheet" href="/public/static/css/base.css" >
    <style type="text/css">
        .table-responsive{
            min-height: 550px;
        }
        tr{
            text-align: center;
            height: 45px;
        }
        a.ncap-btn-green {
            font: bold 14px/20px "microsoft yahei", arial;
            color: #FFF;
            text-shadow: 0 -1px 0 rgba(0,0,0,0.10);
            background-color: #1BBC9D;
            text-align: center;
            vertical-align: middle;
            display: inline-block;
            height: 34px;
            padding: 7px 14px;
            margin-bottom: 5px;
            margin-right: 3px;
            border: solid 1px #BEC3C7;
            border-radius: 3px;
            cursor: pointer;
        }
    </style>
</head>
<body>
{include file="home:header"}
<div class="content">
    <div class="row" style="height: 100%;">
        {include file="home:navigation"}
        <div class="col-md-10">
            <div class="content-wrapper">
                {__CONTENT__}
            </div>
        </div>
    </div>
    {include file="home:footer"}
</div>
<input type="hidden" value='{$token["errMsg"]}' id="token"  />
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true" style=" margin-left: 100px;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
            </div>
            <div class="modal-body" id="modal_yuan" style='text-align: center;'>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                </button>
            </div>
        </div>
    </div>
</div>
<script src="__STATIC__/plugin/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__STATIC__/plugin/JquerySession.js"></script>
<script src="__JS__/common/common.js"></script>
<script src="__JS__/admin/admin.js"></script>
<script type="text/javascript" src="__CSS-JS__/plupload/plupload.full.min.js"></script>
<script src="__JS__/layui/layui.js" charset="utf-8"></script>
<script>

</script>
</body>
</html>
<script type="text/javascript">
    layui.use('laydate', function() {
        var laydate = layui.laydate;
        //时间范围
        laydate.render({
            elem: '#business'
            ,type: 'time',
            range: true
        });
    });
    function getPicture(id) {
        $.ajax({
            type:"post",
            url:"{:url('Admin/Upload/picture')}",
            data:{
                id:id
            },
            success:function (res) {
                document.getElementById("modal_yuan").innerHTML="<img src='__IMG__"+res+"' width='90%' />";
            }
        });
    }
    window.onload = function () {
        var url = window.location.href;
        if(url.search("public") == -1){
            window.location.href = "http://"+window.location.host+"/tp/public/admin.php";
        }
        showLeftTime();
        var token = document.getElementById("token").value;
        if(token != ""){
            SUCCESSAlert("请登录后,在操作");
            setTimeout('login()',3000);
            return;
        }
        if(document.getElementById("error")){
            PageError();
        }
        if(document.getElementById("PS")){
            var pid = document.getElementById("PS").value;
            var group = document.getElementById("group").value;
            onLoadGrop(pid,group);
        }
        if(document.getElementById("typeid") && document.getElementById("sid")){
            var typeid = document.getElementById("typeid").value;
            var sid = document.getElementById("sid").value;
            ServiceitemSId(typeid,sid);
        }
    }
    function Alert(text,id) {
        layer.msg(text,
            {icon:id,time:2000,offset:'t',closeBtn:0,shift:4});
    }
    function login() {
        window.location.href="{:url('Login/Login/login')}";
    }
    function getCheckboxByIds(id) {
        var ids = $("input[id='ids-"+id+"']").is(':checked');
        if(!ids){
            $("input[id='ids']").prop('checked',false);
        }
        var items = document.getElementsByName("ids[]");         //这个语句帮我们筛选出一组name为checked的复选框。。
        for(var j=0; j<items.length; j++){
            if(!items[j].checked){               //如果该复选框被选中
                return;                         //统计被选中的个数
            }
        }
        $("input[id='ids']").prop("checked", "true");
    }
    function getCheckbox() {
        var ids = $("input[id='ids']").is(':checked');
        if(ids) {
            $("input[name='ids[]']").prop("checked", "true");
        } else {
            $("input[name='ids[]']").prop('checked',false);;
        }
    }
    $(document).ready(function(){
        $(".edit-btn").mousemove(function(e){
            this.setAttribute("style","color: #ffffff;background-color: #138de6;");
        });
        $(".edit-btn").mouseout(function(e){
            this.setAttribute("style","background-color: #ffffff;color: #138de6;");
        });
        $(".disable-btn").mousemove(function(e){
            this.setAttribute("style","color: #ffffff;background-color: #ebb724;");
        });
        $(".disable-btn").mouseout(function(e){
            this.setAttribute("style","background-color: #ffffff;color: #ebb724;");
        });
        $(".enable-btn").mousemove(function(e){
            this.setAttribute("style","color: #ffffff;background-color: #2bc286;");
        });
        $(".enable-btn").mouseout(function(e){
            this.setAttribute("style","background-color: #ffffff;color: #2bc286;");
        });
        $(".delete-btn").mousemove(function(e){
            this.setAttribute("style","color: #ffffff;background-color: red;");
        });
        $(".delete-btn").mouseout(function(e){
            this.setAttribute("style","background-color: #ffffff;color: red;");
        });
    });
    layui.use('upload', function(){
        var $ = layui.jquery
            ,upload = layui.upload;

        //普通图片上传
        var uploadInst = upload.render({
            elem: '#test1'
            ,url: '{:url("Admin/Upload/lay_img_upload")}'
            ,before: function(obj){
                obj.preview(function(index, file, result){
                    $('#image').attr('src', result);
                });
            }
            ,done: function(res){
                console.log(res);
                $('#logo').attr('value', res.id);
                //如果上传失败
                if(res.code > 0){
                    return layer.msg('上传失败');
                }
            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });

        uploadInst = upload.render({
            elem: '#test2'
            ,url: '{:url("Admin/Upload/lay_img_upload")}'//'__HTTP__/lay_img_upload'
            ,before: function(obj){
                obj.preview(function(index, file, result){
                    $('#imgs').attr('src', result);
                });
            }
            ,done: function(res){
                $('#img').attr('value', res.id);
                //如果上传失败
                if(res.code > 0){
                    return layer.msg('上传失败');
                }
            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });

        uploadInst = upload.render({
            elem: '#page3'
            ,url: '{:url("Admin/Upload/lay_img_upload")}'
            ,before: function(obj){
                obj.preview(function(index, file, result){
                    $('#pages').attr('src', result);
                });
            }
            ,done: function(res){
                $('#page').attr('value', res.id);
                //如果上传失败
                if(res.code > 0){
                    return layer.msg('上传失败');
                }
            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });
    });
</script>